{% extends 'base.html' %}

{% block title %}场景管理{% endblock %}

{% block content %}
<div class="container-fluid">
    <div class="row mb-3">
        <div class="col">
            <h2>场景管理</h2>
        </div>
    </div>
    
    <div class="row mb-3">
        <div class="col-md-6">
            <div class="input-group">
                <input type="text" id="search-input" class="form-control" placeholder="搜索场景...">
                <button class="btn btn-outline-secondary" type="button" id="search-btn">
                    <i class="bi bi-search"></i> 搜索
                </button>
            </div>
        </div>
        <div class="col-md-6 text-end">
            <button class="btn btn-primary" id="add-scene-btn" data-bs-toggle="modal" data-bs-target="#addEditModal">
                <i class="bi bi-plus-circle"></i> 新增场景
            </button>
        </div>
    </div>
    
    <div class="row">
        <div class="col">
            <div class="card">
                <div class="card-body">
                    <div class="table-responsive">
                        <table class="table table-hover">
                            <thead>
                                <tr>
                                    <th>名称</th>
                                    <th>描述</th>
                                    <th>步骤数</th>
                                    <th>标签</th>
                                    <th>更新时间</th>
                                    <th>操作</th>
                                </tr>
                            </thead>
                            <tbody id="scene-list">
                                <!-- 场景列表将通过JavaScript动态加载 -->
                            </tbody>
                        </table>
                    </div>
                    
                    <div id="pagination" class="d-flex justify-content-between align-items-center mt-3">
                        <div>
                            <span id="pagination-info">显示 1-10 条，共 0 条</span>
                        </div>
                        <nav>
                            <ul class="pagination">
                                <!-- 分页将通过JavaScript动态加载 -->
                            </ul>
                        </nav>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- 新增/编辑场景模态框 -->
{% include 'scene/add_edit_modal.html' %}

<!-- 删除场景确认模态框 -->
{% include 'scene/delete_modal.html' %}

{% endblock %}

{% block scripts %}
<script src="/static/js/sortable.min.js"></script>
<script src="/static/js/scene_functions.js"></script>
<script src="/static/js/scene_functions_part2.js"></script>
<script src="/static/js/scene_functions_part3.js"></script>
<script src="/static/js/modal_api_loader.js"></script>
{% endblock %}